package com.itheima.reggie.controller;

import com.itheima.reggie.common.R;
import com.itheima.reggie.entity.Orders;
import com.itheima.reggie.service.OrdresService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.Date;

@RestController
@RequestMapping("/order")
public class OrdersController {
    @Autowired
    private OrdresService ordresService;

    @PostMapping("/submit")
    public R submit(@RequestBody Orders orders){
        return ordresService.submit(orders);
    }
    @GetMapping("/userPage")
    public R newPage(Integer page,Integer pageSize){
        R r =ordresService.newPage(page,pageSize);
        return r;
    }
    @GetMapping("/page")
    public R findPage(Integer page, Integer pageSize, String number, LocalDateTime beginTime, LocalDateTime endTime){
       R r = ordresService.findPage(page,pageSize,number,beginTime,endTime);
       return r;
    }
}
